﻿FROM quay.io/centos/centos:stream9

WORKDIR /app

RUN dnf update -y&& \
    dnf groupinstall -y "Development Tools" && \
    dnf install -y \
        wget \
        openssl-devel \
        libffi-devel \
        bzip2-devel \
        sqlite-devel \
        readline-devel \
        tk-devel \
        ncurses-devel \
        xz-devel && \
    cd /tmp && \
    wget https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz && \
    tar xzf Python-3.13.0.tgz && \
    cd Python-3.13.0 && \
    ./configure --enable-optimizations --with-ensurepip=install && \
    make altinstall && \
    ln -sf /usr/local/bin/python3.13 /usr/local/bin/python3 && \
    ln -sf /usr/local/bin/python3.13 /usr/local/bin/python && \
    ln -sf /usr/local/bin/pip3.13 /usr/local/bin/pip3 && \
    ln -sf /usr/local/bin/pip3.13 /usr/local/bin/pip && \
    rm -rf /tmp/Python-3.13.0* && \
    dnf clean all


RUN pip install --upgrade pip

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt


copy . .

# 设置权限
RUN chmod -R 755 /app/uploads

EXPOSE 8080

ENV PYTHONPATH = /app
ENV PYTHONUNBUFFERED=1

CMD ["python", "app.py"]




